<?php  
header("Pragma: public");
header("Expires: 0");
header("Accept-Ranges: bytes");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/vnd.ms-excel");
header('Content-Disposition: attachment; filename=abiturientscheckout.xls');
header("Content-Transfer-Encoding: binary");

//debug($abiturients_selectedprofessions);
// debug($abiturients);

?>
<table width="100%" border="1" cellspacing="2" cellpadding="2">
  <tr>
<td><strong>ID</strong></td>
    <td><strong>ФИО</strong></td>
    <td><strong>Зачислен</strong></td>
    <td><strong>П1</strong></td>
    <td><strong>П2</strong></td>
    <td><strong>П3</strong></td>
    <td><strong>П4</strong></td>
    <td><strong>П5</strong></td>
    <td><strong>П6</strong></td>
    <td><strong>Сп1</strong></td>
    <td><strong>Сп2</strong></td>
    <td><strong>Сп3</strong></td>
    <td><strong>Сп4</strong></td>
    <td><strong>Сп5</strong></td>
    <td><strong>Сп6</strong></td>
    <td><strong>Сп7</strong></td>
    <td><strong>Сп8</strong></td>
    <td><strong>Сп9</strong></td>
    <td><strong>Сп10</strong></td>
    <td><strong>Сп11</strong></td>
    <td><strong>Сп12</strong></td>
    <td><strong>Льгот</strong></td>
    <td><strong>Целевое</strong></td>
    <td><strong>Приоритет</strong></td>
    <td><strong>Подлинник</strong></td>
  </tr>
  <?php
 foreach($abiturients as $abiturient):
?>
<tr>
	<td>
	<?php
		echo $abiturient['Abiturient']['id'];
	?>
    </td>
        <td>
    	<?php 
    	echo $abiturient['Abiturient']['lastname'].' ';
    	echo $abiturient['Abiturient']['firstname'].' ';
    	echo $abiturient['Abiturient']['surname'];		
		?>
    </td>
    <td>
    <?php 
    	if ($abiturient['Enrolledstudent']){
 			$selectedprofession = $abiturient['Enrolledstudent'];
  			$resultedprofession ='';
  			switch ($selectedprofession[0]['profession_id']){
  				case '1': $resultedprofession .='Л'; break;
  				case '2': $resultedprofession .='П'; break;
  				case '3': $resultedprofession .='СТ'; break;
  				case '4': $resultedprofession .='МПр'; break;
  				case '5': $resultedprofession .='Ф'; break;
  				case '6': $resultedprofession .='Э'; break;
  				case '7': $resultedprofession .='КлП'; break;
  				case '8': $resultedprofession .='СР'; break;
  				case '9': $resultedprofession .='БТ'; break;
  				case '10': $resultedprofession .='срЛ'; break;
  				case '11': $resultedprofession .='срС'; break;
  				case '12': $resultedprofession .='срЛД'; break;
  				case '13': $resultedprofession .='срФ'; break;
  				case '15': $resultedprofession .='М'; break;
  			}
  			switch ($selectedprofession[0]['learningform_id']){
  				case '1': $resultedprofession .='О'; break;
  				case '2': $resultedprofession .='З'; break;
  				case '3': $resultedprofession .='Экст'; break;
  			}
  			switch ($selectedprofession[0]['learningtype_id']){
  				case '1': $resultedprofession .='Б'; break;
  				case '2': $resultedprofession .='В'; break;
  			}
  		
  			echo '<font color=red><b>'.$resultedprofession.'</b></font>';    	
    	}  
    	?>
    </td>
    <?php $resultscount = count ($abiturient['Result']);?>
        <td>
    	<?php 
    		if ($resultscount >= 1){
    			echo $subjects[$abiturient['Result'][0]['subject_id']].' ';
    			echo $abiturient['Result'][0]['score'];
    		}
		?>
    </td>
        <td>
    	<?php 
    	if ($resultscount >= 2){
    		echo $subjects[$abiturient['Result'][1]['subject_id']].' ';
    		echo $abiturient['Result'][1]['score'];
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($resultscount >= 3){
    		echo $subjects[$abiturient['Result'][2]['subject_id']].' ';
    		echo $abiturient['Result'][2]['score'];
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($resultscount >= 4){
    		echo $subjects[$abiturient['Result'][3]['subject_id']].' ';
    		echo $abiturient['Result'][3]['score'];
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($resultscount >= 5){
    		echo $subjects[$abiturient['Result'][4]['subject_id']].' ';
    		echo $abiturient['Result'][4]['score'];
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($resultscount >= 6){
    		echo $subjects[$abiturient['Result'][5]['subject_id']].' ';
    		echo $abiturient['Result'][5]['score'];
    	}		
		?>
    </td>
    <?php 
    	// перебирам записи иитуриентов
    	$current_abiturient_selectedprofessions = null;
    	foreach ($abiturients_selectedprofessions as $abiturient_selectedprofessions):
    		if ($abiturient_selectedprofessions) {
    			if ($abiturient_selectedprofessions[0]['Selectedprofession']['abiturient_id'] == $abiturient['Abiturient']['id']) {
    				$current_abiturient_selectedprofessions = $abiturient_selectedprofessions;
    				break;
    			}
    		}
    	endforeach;
    	$selectedprofessionscount = count ($current_abiturient_selectedprofessions);
    	//$selectedprofessionscount = count ($abiturient['Selectedprofession']);
    ?>
        <td>
    	<?php 
		if ($selectedprofessionscount >= 1){
			$resultedprofession ='';
			//switch ($abiturient['Selectedprofession'][0]['profession_id']){
			switch ($current_abiturient_selectedprofessions[0]['Selectedprofession']['profession_id']){
			case '1': $resultedprofession .='Л'; break;
			case '2': $resultedprofession .='П'; break;
			case '3': $resultedprofession .='СТ'; break;
			case '4': $resultedprofession .='МПр'; break;
			case '5': $resultedprofession .='Ф'; break;
			case '6': $resultedprofession .='Э'; break;
			case '7': $resultedprofession .='КлП'; break;
			case '8': $resultedprofession .='СР'; break;
			case '9': $resultedprofession .='БТ'; break;
			case '10': $resultedprofession .='срЛ'; break;
			case '11': $resultedprofession .='срС'; break;
			case '12': $resultedprofession .='срЛД'; break;
			case '13': $resultedprofession .='срФ'; break;
			case '15': $resultedprofession .='М'; break;
			}
			switch ($current_abiturient_selectedprofessions[0]['Selectedprofession']['learningform_id']){
				case '1': $resultedprofession .='О'; break;
				case '2': $resultedprofession .='З'; break;
				case '3': $resultedprofession .='Экст'; break;
			}
			switch ($current_abiturient_selectedprofessions[0]['Selectedprofession']['learningtype_id']){
				case '1': $resultedprofession .='Б'; break;
				case '2': $resultedprofession .='В'; break;
			}		
			echo $resultedprofession;	
		}
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 2){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[1]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[1]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[1]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 3){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[2]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[2]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[2]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 4){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[3]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[3]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[3]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 5){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[4]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[4]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[4]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 6){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[5]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[5]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[5]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 7){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[6]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[6]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[6]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 8){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[7]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[7]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[7]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 9){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[8]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[8]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[8]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 10){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[9]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[9]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[9]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 11){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[10]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[10]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[10]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($selectedprofessionscount >= 12){
    		$resultedprofession ='';
    		switch ($current_abiturient_selectedprofessions[11]['Selectedprofession']['profession_id']){
    			case '1': $resultedprofession .='Л'; break;
    			case '2': $resultedprofession .='П'; break;
    			case '3': $resultedprofession .='СТ'; break;
    			case '4': $resultedprofession .='МПр'; break;
    			case '5': $resultedprofession .='Ф'; break;
    			case '6': $resultedprofession .='Э'; break;
    			case '7': $resultedprofession .='КлП'; break;
    			case '8': $resultedprofession .='СР'; break;
    			case '9': $resultedprofession .='БТ'; break;
    			case '10': $resultedprofession .='срЛ'; break;
    			case '11': $resultedprofession .='срС'; break;
    			case '12': $resultedprofession .='срЛД'; break;
    			case '13': $resultedprofession .='срФ'; break;
    			case '15': $resultedprofession .='М'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[11]['Selectedprofession']['learningform_id']){
    			case '1': $resultedprofession .='О'; break;
    			case '2': $resultedprofession .='З'; break;
    			case '3': $resultedprofession .='Экст'; break;
    		}
    		switch ($current_abiturient_selectedprofessions[11]['Selectedprofession']['learningtype_id']){
    			case '1': $resultedprofession .='Б'; break;
    			case '2': $resultedprofession .='В'; break;
    		}
    		echo $resultedprofession;
    	}		
		?>
    </td>
        <td>
    	<?php 
		if ($abiturient['Privilege']){
			foreach ($abiturient['Privilege'] as $privilege):
			 echo $privilege['name'].' ';
			endforeach;
		}
		?>
    </td>
        <td>
    	<?php 
    	if ($abiturient['Targetingintake']){
    		foreach ($abiturient['Targetingintake'] as $tgintake):
    		echo $regions[$tgintake['region_id']].' обл ';
    		echo $facultets[$tgintake['facultet_id']].'ф-т ';
    		echo $professions[$tgintake['profession_id']].' ';
    		echo $learningforms[$tgintake['learningform_id']].' ';
    		echo $learningtypes[$tgintake['learningtype_id']].' ';   
    		echo $tgintakeorgs[$tgintake['tgintakeorg_id']].'</ br> ';
    		endforeach;
    	}		
		?>
    </td>
        <td>
    	<?php 
    	if ($abiturient['Prioritet']){
    		foreach ($abiturient['Prioritet'] as $prioritet):
    		echo $prioritet['name'].' ';
    		endforeach;
    	}		
		?>
    </td>
        <td>
	<?php
	if ($abiturient['Abiturient']['originaleducationdoc']){
		echo 'ДА';
	} else {
		echo 'НЕТ';
	}
	?>
    </td>
  </tr>
<?php 
  endforeach;
?>
</table>